package com.unohacha.qqj.fzdr.bean;

import com.alibaba.fastjson.JSON;

import java.util.List;

/**
 * author：swt
 * date：2018/8/9
 * desc：基类bean
 */
public class BaseModel {
    public <T extends BaseModel> T toBean(String jsonStr) throws Exception {
        return (T) JSON.parseObject(jsonStr, this.getClass());
    }


    public <T extends BaseModel> List<T> toList(String jsonStr) throws Exception {
        return (List<T>) JSON.parseArray(jsonStr, this.getClass());
    }
}
